package IO流;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.SequenceInputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;

public class SequenceInputStream合并流 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis1 = new FileInputStream("C:\\Users\\gdq\\OneDrive\\桌面\\File文件夹\\a.txt");
        FileInputStream fis2 = new FileInputStream("C:\\Users\\gdq\\OneDrive\\桌面\\File文件夹\\777.txt");
        ArrayList<FileInputStream> list = new ArrayList<>();
        list.add(fis1);
        list.add(fis2);
        Enumeration<FileInputStream> en = Collections.enumeration(list);
        SequenceInputStream sis = new SequenceInputStream(en);
        int a;
        while ((a = sis.read()) != -1){
            System.out.print((char) a);
        }
        sis.close();
    }
}
